package com.hefei

import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author caizhengjun
 * @date 2020/8/27 8:51 下午
 */
object RDDTest4 {

  def main(args: Array[String]): Unit = {

    val conf = new SparkConf().setMaster("local[2]").setAppName(this.getClass.getSimpleName)

    val sc: SparkContext = new SparkContext(conf)

    sc.parallelize(Seq(("a", 1), ("a", 1), ("b", 1)))
      .reduceByKey(_ + _)
      .collect().foreach(println(_))
  }

}
